feat(interceptor): add measured zoom so appearance claims can close on real pixels - #1657
Closed
elhoim wants to merge 1 commit into
Closed
feat(interceptor): add measured zoom so appearance claims can close on real pixels#1657elhoim wants to merge 1 commit into
elhoim wants to merge 1 commit into
Conversation
Images are downscaled to ~1568px on the long edge before the model sees them. On a 2000px-wide page a 40px logo arrives as a smudge, and cropping the delivered screenshot cannot recover it — the detail was destroyed upstream. That is the failure mode behind the appearance-vs-existence rule: a screenshot proves an element exists, not what it looks like. Zoom.ts takes absolute coordinates in the ORIGINAL image, crops from the full-resolution source, and magnifies that region to the image budget, so the pixels spent land on the thing under test. Nearest-neighbour on the upscale, so it magnifies without inventing detail. It never downscales: a region already past the budget is passed through at native size. Prefers `magick` (the binary Capture.sh and VerifyImageProbe.ts already use) and falls back to `ffmpeg` so it works on hosts without ImageMagick. Out-of-bounds, zero-area and negative-origin crops exit 2 with the source dimensions in the message rather than emitting a misleading image. (cherry picked from commit 6bbe5e2)
Owner
|
Ported into source with credit — thank you. The public repo is generated from a private tree at release time, so merging here would be reverted at the next cut; the intent landed in source instead, with your handle and this PR number in the code comment at the fix site. One note: local source had moved since your base, so the port is adapted rather than byte-identical — same fix, fitted to current code. Details are in the commit. Closing as ported. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
skills/Interceptor/Tools/Zoom.ts— measured zoom for appearance verification.The problem
Images are downscaled to roughly 1568px on the long edge before a model sees them. On a 2000px-wide page a 40px logo arrives as a smudge, and cropping the delivered screenshot cannot recover it — the detail was destroyed upstream. That is the gap between "a screenshot proves this element exists" and "a screenshot proves what it looks like".
The tool
Takes absolute pixel coordinates in the original image, crops from the full-resolution source, and magnifies that region to the image budget, so the pixels spent land on the thing under test.
magick(the binaryCapture.shandVerifyImageProbe.tsalready use) and falls back toffmpeg, so it works on hosts without ImageMagick.A DOM-coordinate read (
eval) gives you the region to pass.Verification
A 2000×1200 source with a 40×24 marker — the kind of detail a full-page screenshot destroys. Zooming a 60×44 region around it produced 1568×1150 at 26.13×, marker colour preserved, and the output was inspected visually: a speck in the source fills the frame in the zoom with the requested 10px margins on each side.
All eight guard paths exercised: out-of-bounds, zero width, negative origin, missing argument, missing file, no args, non-numeric budget, and an oversized region (passes through at 1.00×, confirmed still 2000×1200).
Also adds a gotcha to
Interceptor/SKILL.mddescribing when to reach for it — logo, glyph, font rendering, icon, or few-pixel spacing claims.No
.help.md: none of Interceptor's eight tools carry one, and the tool self-documents via its usage error.